<?php 
include_once('connection/connection.php');
include('config.php');
//session_start();
//ob_start();
include('header.php');
include('menu.php');
$formId=trim($_REQUEST['formId']);
//echo $formId=$_SESSION['formID'];
$sqlGetFormDetails="select * from tbl_dtls_q1_main where id=$formId";
$queryFormDetails=mysql_query($sqlGetFormDetails);
$rowFormDetails=mysql_fetch_array($queryFormDetails);

/*$sqlRising="select * from tbl_dtls_q1_pipeline_ris_dis where loc_id = $formId AND rising_material != ''";
$recRising=mysql_query($sqlRising);
$rowRising=mysql_fetch_array($recRising);

$sqlRising2="select * from tbl_dtls_q1_pipeline_ris_dis where loc_id = $formId AND distri_material != ''";
$recRising2=mysql_query($sqlRising2);
$rowRising2=mysql_fetch_array($recRising2);*/

$sqlRising="select * from tbl_dtls_q1_pipeline_ris_dis where loc_id = $formId AND rising_material != '0'";
$recRising=mysql_query($sqlRising);
$countArr=1;
while($rowRising=mysql_fetch_array($recRising))
{
	$arrMeterial[$countArr]=$rowRising['rising_material'];
	$arrSize[$countArr]=$rowRising['rising_size'];
	$arrLength[$countArr]=$rowRising['rising_length'];
	$countArr++;
}
//print_r($arrMeterial);
$sqlRising2="select * from tbl_dtls_q1_pipeline_ris_dis where loc_id = $formId AND distri_material != '0'";
$recRising2=mysql_query($sqlRising2);
$countArr2=1;
while($rowRising2=mysql_fetch_array($recRising2))
{
	$arrMeterial2[$countArr2]=$rowRising2['distri_material'];
	$arrSize2[$countArr2]=$rowRising2['distri_size'];
	$arrLength2[$countArr2]=$rowRising2['distri_length'];
	$countArr2++;
}


$jsOnLoad="show_subm1(".$formId.");show_mono1(".$formId.");show_centi1(".$formId.");show_sp1(".$formId.");show_cwr_cap1(".$formId.");show_glsr_cap1(".$formId.");show_glr_cap1(".$formId.");show_ohsr_cap1(".$formId.");showpsp1_q1(".$formId.");";
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" src="js/ajaxFunction1_q1.js"></script>
<script language="javascript" type="text/javascript" src="js/validate1.js"></script>
<script language="Javascript" type="text/javascript" src="js/editajaxFunction1_q1.js"></script>
<script language=javascript>
function formshow_glr(val,i)
{ 
		if(val == "YES" )
		{
			document.getElementById('glr'+i).style.display = "block";	
		}
		else
		{
			document.getElementById('glr'+i).style.display = "none";
		} 
}
function formshow_cwt(val,i)
{
		if(val == "YES")
		{	
			document.getElementById('cwt'+i).style.display = "block";
		}
		else
		{
			document.getElementById('cwt'+i).style.display = "none";
		}
}
function mult()
{
	var value1=document.getElementById('population').value;
	var value2=(value1 * 0.04);
	//var value2=Math.round(value1 * 1.4);
	document.getElementById('water_demand').value=value2;	
}
</script>
<title>Questionnaire No.1</title>
</head>
<body onLoad="<?php echo $jsOnLoad;?>">
<?php
if(isset($_POST['submit']))
{
		$fclick = true;
		//$loc_id = $_SESSION['loc_id'];
		$loc_id = $formId;
		$population=$_POST['population'];
		$water_demand=$_POST['water_demand'];
		$sub_total=$_POST['sub_total'];
		$mono_total=$_POST['mono_total'];
		$centi_total=$_POST['centi_total'];
		$sp_total=$_POST['sp_total'];
		$cwr_total=$_POST['cwr_total'];
		$cwr_sc_st=$_POST['cwr_sc_st'];
		$glsr_total=$_POST['glsr_total'];
		$glsr_sc_st=$_POST['glsr_sc_st'];
		$glr_total=$_POST['glr_total'];
		$glr_sc_st=$_POST['glr_sc_st'];
		$ohsr_total=$_POST['ohsr_total'];
		$ohsr_sc_st=$_POST['ohsr_sc_st'];
		$psp_total=$_POST['psp_total'];
		$psp_sc_st=$_POST['psp_sc_st'];
		
		$qr1="UPDATE tbl_dtls_q1_main SET population='$population', water_demand='$water_demand', sub_total='$sub_total', mono_total='$mono_total', centi_total='$centi_total', sp_total='$sp_total', cwr_total='$cwr_total', cwr_sc_st='$cwr_sc_st', glsr_total='$glsr_total', glsr_sc_st='$glsr_sc_st', glr_total='$glr_total', glr_sc_st='$glr_sc_st', ohsr_total='$ohsr_total', ohsr_sc_st='$ohsr_sc_st', psp_total='$psp_total', psp_sc_st='$psp_sc_st' WHERE id=$formId";	
		//echo $qr1;
			$result1=mysql_query($qr1);
			if($result1) 
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error updating main table <br>";
			}
		$qrdel_sub="Delete from tbl_dtls_q1_asset where loc_id=$formId AND asset_id LIKE ('Sub%')";
		$resdel_sub=mysql_query($qrdel_sub);	
		for($i=1; $i<=$sub_total; $i++)
		{	
		$sub_id='sub_id'.$i;
		$sub_status='sub_status'.$i;
		$sub_discharge='sub_discharge'.$i;
		$sub_head='sub_head'.$i;
		$sub_power='sub_power'.$i;
		
		$sub_id=$_POST[$sub_id];
		$sub_status=$_POST[$sub_status];
		$sub_discharge=$_POST[$sub_discharge];
		$sub_head=$_POST[$sub_head];
		$sub_power=$_POST[$sub_power];
		$qr1="INSERT INTO tbl_dtls_q1_asset(loc_id, asset_id, asset_status, asset_discharge, asset_head, asset_power) VALUES ('$loc_id', '$sub_id', '$sub_status', '$sub_discharge', '$sub_head', '$sub_power')";
			//echo $qr;
		$res1=mysql_query($qr1);
		}
			if($res1)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting asset table <br>";
			}
		$qrdel_mono="Delete from tbl_dtls_q1_asset where loc_id=$formId AND asset_id LIKE ('mono%')";
		$resdel_mono=mysql_query($qrdel_mono);	
		for($i=1; $i<=$mono_total; $i++)
		{
		$mono_id='mono_id'.$i;
		$mono_status='mono_status'.$i;
		$mono_discharge='mono_discharge'.$i;
		$mono_head='mono_head'.$i;
		$mono_power='mono_power'.$i;
		
		$mono_id=$_POST[$mono_id];
		$mono_status=$_POST[$mono_status];
		$mono_discharge=$_POST[$mono_discharge];
		$mono_head=$_POST[$mono_head];
		$mono_power=$_POST[$mono_power];
		$qr2="INSERT INTO tbl_dtls_q1_asset(loc_id, asset_id, asset_status, asset_discharge, asset_head, asset_power) VALUES ('$loc_id', '$mono_id', '$mono_status', '$mono_discharge', '$mono_head', '$mono_power')";
			//echo $qr;
			$res2=mysql_query($qr2);
		}
		if($res2)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting asset table <br>";
			}
		$qrdel_centi="Delete from tbl_dtls_q1_asset where loc_id=$formId AND asset_id LIKE ('centi%')";
		$resdel_centi=mysql_query($qrdel_centi);	
		for($i=1; $i<=$centi_total; $i++)
		{
		$centi_id='centi_id'.$i;
		$centi_status='centi_status'.$i;
		$centi_discharge='centi_discharge'.$i;
		$centi_head='centi_head'.$i;
		$centi_power='centi_power'.$i;
		
		$centi_id=$_POST[$centi_id];
		$centi_status=$_POST[$centi_status];
		$centi_discharge=$_POST[$centi_discharge];
		$centi_head=$_POST[$centi_head];
		$centi_power=$_POST[$centi_power];	
		$qr3="INSERT INTO tbl_dtls_q1_asset(loc_id, asset_id, asset_status, asset_discharge, asset_head, asset_power) VALUES ('$loc_id', '$centi_id', '$centi_status', '$centi_discharge', '$centi_head', '$centi_power')";
			//echo $qr;
			$res3=mysql_query($qr3);
		}
		if($res3)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting asset table <br>";
			}
		$qrdel_sp="Delete from tbl_dtls_q1_asset where loc_id=$formId AND asset_id LIKE ('Sp%')";
		$resdel_sp=mysql_query($qrdel_sp);	
		for($i=1; $i<=$sp_total; $i++)
		{
		$sp_id='sp_id'.$i;
		$sp_status='sp_status'.$i;
		$sp_discharge='sp_discharge'.$i;
		$sp_head='sp_head'.$i;
		$sp_power='sp_power'.$i;
		
		$sp_id=$_POST[$sp_id];
		$sp_status=$_POST[$sp_status];
		$sp_discharge=$_POST[$sp_discharge];
		$sp_head=$_POST[$sp_head];
		$sp_power=$_POST[$sp_power];
		$qr4="INSERT INTO tbl_dtls_q1_asset(loc_id, asset_id, asset_status, asset_discharge, asset_head, asset_power) VALUES ('$loc_id', '$sp_id', '$sp_status', '$sp_discharge', '$sp_head', '$sp_power')";
			//echo $qr;
			$res4=mysql_query($qr4);
		}
		if($res4)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting asset table <br>";
			}
		$qrdel_cwr="Delete from tbl_dtls_q1_reserv where loc_id=$formId AND reserv_id LIKE ('CWR%')";
		$resdel_cwr=mysql_query($qrdel_cwr);	
		for($i=1; $i<=$cwr_total; $i++)
		{
			$cwr_id='cwr_id'.$i;
			$cwr_capacity='cwr_capacity'.$i;
			$cwr_id=$_POST[$cwr_id];
			$cwr_capacity=$_POST[$cwr_capacity];
			$qr5="INSERT INTO tbl_dtls_q1_reserv(loc_id, reserv_id, reserv_cap) VALUES ('$loc_id', '$cwr_id', '$cwr_capacity')";
			//echo $qr;
			$res5=mysql_query($qr5);
		}
		if($res5)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting reserv table <br>";
			}

		$qrdel_glsr="Delete from tbl_dtls_q1_reserv where loc_id=$formId AND reserv_id LIKE ('GLSR%')";
		$resdel_glsr=mysql_query($qrdel_glsr);
		for($i=1; $i<=$glsr_total; $i++)
		{
			$glsr_id='glsr_id'.$i;
			$glsr_capacity='glsr_capacity'.$i;
			$glsr_id=$_POST[$glsr_id];
			$glsr_capacity=$_POST[$glsr_capacity];
			$qr6="INSERT INTO tbl_dtls_q1_reserv(loc_id, reserv_id, reserv_cap) VALUES ('$loc_id', '$glsr_id', '$glsr_capacity')";
			$res6=mysql_query($qr6);
		}
		if($res6)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting reserv table <br>";
			}
		$qrdel_glr="Delete from tbl_dtls_q1_reserv where loc_id=$formId AND reserv_id LIKE ('GLR%')";
		$resdel_glr=mysql_query($qrdel_glr);
		for($i=1; $i<=$glr_total; $i++)
		{
			$glr_id='glr_id'.$i;
			$glr_capacity='glr_capacity'.$i;
			$glr_id=$_POST[$glr_id];
			$glr_capacity=$_POST[$glr_capacity];
			$qr7="INSERT INTO tbl_dtls_q1_reserv(loc_id, reserv_id, reserv_cap) VALUES ('$loc_id', '$glr_id', '$glr_capacity')";
			$res7=mysql_query($qr7);
		}
		if($res7)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting reserv table <br>";
			}
		$qrdel_ohsr="Delete from tbl_dtls_q1_reserv where loc_id=$formId AND reserv_id LIKE ('OHSR%')";
		$resdel_ohsr=mysql_query($qrdel_ohsr);
		for($i=1; $i<=$ohsr_total; $i++)
		{
			$ohsr_id='ohsr_id'.$i;
			$ohsr_capacity='ohsr_capacity'.$i;
			$ohsr_id=$_POST[$ohsr_id];
			$ohsr_capacity=$_POST[$ohsr_capacity];
			$qr8="INSERT INTO tbl_dtls_q1_reserv(loc_id, reserv_id, reserv_cap) VALUES ('$loc_id', '$ohsr_id', '$ohsr_capacity')";
			//echo $qr;
			$res8=mysql_query($qr8);
		}
		if($res8)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting reserv table <br>";
			}
		$qrdel_pipe="Delete from tbl_dtls_q1_pipeline_ris_dis where loc_id=$formId";
		$resdel_pipe=mysql_query($qrdel_pipe);			     	
		for($i=1; $i<=12; $i++)
		{
			$ris_material='ris_material'.$i;
			$ris_size='ris_size'.$i;
			$ris_length='ris_length'.$i;
			$dis_material='dis_material'.$i;
			$dis_size='dis_size'.$i;
			$dis_length='dis_length'.$i;
			$ris_material=$_POST[$ris_material];
			$ris_size=$_POST[$ris_size];
			$ris_length=$_POST[$ris_length];
			$dis_material=$_POST[$dis_material];
		    $dis_size=$_POST[$dis_size];
			$dis_length=$_POST[$dis_length];
			if($ris_material!="0" || $dis_material!="0"){
			$qr9="INSERT INTO tbl_dtls_q1_pipeline_ris_dis(loc_id, rising_material, rising_size, rising_length, distri_material, distri_size, distri_length) VALUES ('$loc_id', '$ris_material', '$ris_size', '$ris_length', '$dis_material', '$dis_size', '$dis_length')";
			//"UPDATE tbl_dtls_q1_main SET population='$population', water_demand='$water_demand', sub_total='$sub_total', mono_total='$mono_total', centi_total='$centi_total', sp_total='$sp_total', cwr_total='$cwr_total', cwr_sc_st='$cwr_sc_st', glsr_total='$glsr_total', glsr_sc_st='$glsr_sc_st', glr_total='$glr_total', glr_sc_st='$glr_sc_st', ohsr_total='$ohsr_total', ohsr_sc_st='$ohsr_sc_st', psp_total='$psp_total', psp_sc_st='$psp_sc_st' WHERE id=$formId"
			//echo $qr3="UPDATE tbl_dtls_q1_pipeline_ris_dis SET rising_material='$ris_material', rising_size='$ris_size', rising_length='$ris_length', distri_material='$dis_material', distri_size='$dis_size', distri_length='$dis_length' WHERE loc_id=$formId";
			//echo $qr3;
			$result9=mysql_query($qr9);
		}	
			}
			if($result9)
			{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			}
			else 
			{
				$errorIns.="Error inserting pipeline table <br>";
			}
			$qrdel_psp="Delete from tbl_dtls_q1_psp where loc_id=$formId";
			$resdel_psp=mysql_query($qrdel_psp);
			for($i=1; $i<=$psp_total; $i++)
			{
				$psp_taps='psp_taps'.$i;
				$psp_loc='psp_loc'.$i;
				$psp_glr='psp_glr'.$i;
				$psp_cwt='psp_cwt'.$i;
				$sc_st='sc_st'.$i;
				
				$psp_taps=$_POST[$psp_taps];
				$psp_loc=$_POST[$psp_loc];
				$psp_glr=$_POST[$psp_glr];
				$psp_cwt=$_POST[$psp_cwt];
				$sc_st=$_POST[$sc_st];
				
				$qr10="INSERT INTO tbl_dtls_q1_psp(loc_id, psp_taps, psp_loc, attached_glr, attached_cwt, sc_st) VALUES ('$loc_id', '$psp_taps', '$psp_loc', '$psp_glr', '$psp_cwt', '$sc_st')"; 
				//echo $qr4;
				$result10=mysql_query($qr10);
			}	
				if($result10)
				{
				$relocatePage=true;
				//header('Location: critical_form2.php');
				//echo "success 2";
			    }
			     else 
			      {
				$errorIns.="Error inserting psp table <br>";
			       }
			
			if($errorIns==0) 
			{
				//header('Location: editquestionnaire1_3.php');
				echo'<span class="successmssg"><b>Congratulation!!</b><br/>You have successfully updated this Page. Please go to <a href="dd_questionnaire_page.php">Edit Questionnaire Page Wise</a></span>';
				exit();
			}
			else 
			{
				echo $errorIns;exit;
			}						
}
else
{
	$fclick = false;
	$flag=0;
}
?>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" name="questionnaire1_2" id="questionnaire1_2" onSubmit="return validate2()">
	<table border="0" width="750" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30" align="center">
				<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
				Questionnaire No.1</font></td>
		</tr>
		<tr>
			<td height="19" align="center"><font face="Arial" style="font-size: 8.5pt" color="#000000">(For PHED Officials)</font></td>
		</tr>
		<tr>
			<td align="center"><font face="Arial" style="font-size: 8.5pt" color="#000000">page 2</font></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
				<span style="font-weight: 700">
				<font face="Arial" style="font-size: 8.5pt">Engineering Aspects</font></span></font></td>
		</tr>
		<tr>
		  <td><table border="0" width="750" id="table9" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0">
            <tr>
              <td colspan="2"><span style="font-size: 4pt">&nbsp;</span> </td>
            </tr>
            <tr>
              <td colspan="2"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; <b>Design Parameters</b></font></td>
            </tr>
            <tr>
              <td width="268"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
                Population ( As per Design )</font></td>
              <td width="237"><input type="text" name="population" id="population" class="txt" onBlur="mult();numeric(this)" value="<?php echo $rowFormDetails['population'];?>"></td>
            </tr>
            <tr>
              <!--<td>&nbsp; <font style="font-size: 8.5pt" face="Verdana" color="#000000"> Water Demand (As per Design ) in KLD</font></td>-->
            <td width="237"><input type="hidden" name="water_demand" id="water_demand" class="txt" value="<?php echo $rowFormDetails['water_demand'];?>">&nbsp;
			<!--<font style="font-size: 8.5pt" face="Verdana" color="#000000">0.04 times of population</font>-->
			</td>
            </tr>
            <tr>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2">&nbsp;<font face="Verdana" color="#000000"><b><font style="font-size: 8.5pt"> Assets </font></b></font><font style="font-size: 8.5pt"><b> <font face="Verdana" color="#000000">(As in records) index 
                map for regional scheme to be provided in whatever form is 
                available </font></b></font></td>
            </tr>
            <tr>
              <td colspan="2">&nbsp; <font face="Verdana" color="#000000"><b> <font style="font-size: 8.5pt">Pumping Machinery </font></b> </font></td>
            </tr>
            <tr>
              <td colspan="3"><table border="0" width="751" cellspacing="0">
                  <tr>
                    <td align="center" height="28" bgcolor="#F7E6B7" width="27%"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Type</font></td>
                    <td align="center" height="28" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Total Nos.</font></td>
                    <tr align="center">
                    <td width="27%"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Submersible</font></td>
                    <td width="73%"><input type="text" name="sub_total" id="sub_total" size="18" class="txt5" onBlur="numeric(this);show_subm()" value="<?php echo $rowFormDetails['sub_total'];?>"></td>
                  </tr>
				  <tr>
					<td></td>
                    <td><div id="subm"></div></td>
				  </tr>
                  <tr align="center">
                    <td width="27%"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Mono - Block</font></td>
                    <td width="73%"><input type="text" name="mono_total" id="mono_total" size="18" class="txt5" onBlur="show_mono();numeric(this)" value="<?php echo $rowFormDetails['mono_total'];?>"></td>                    
                  </tr>
				  <tr>
					<td></td>
                    <td><div id="mono"></div></td>
				  </tr>
                  <tr align="center">
                    <td width="27%"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Centrifugal</font></td>
                    <td width="73%"><input type="text" name="centi_total" id="centi_total" size="18" class="txt5" onBlur="show_centi();numeric(this)" value="<?php echo $rowFormDetails['centi_total'];?>"></td>
                  </tr>
				  <tr>
					<td></td>
                    <td><div id="centi"></div></td>
				  </tr>
                  <tr align="center">
                    <td width="27%"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Single Phase</font></td>
                    <td width="73%"><input type="text" name="sp_total" id="sp_total" size="18" class="txt5" onBlur="show_sp();numeric(this)" value="<?php echo $rowFormDetails['sp_total'];?>"></td>
                   </tr>
				  <tr>
					<td></td>
                    <td><div id="sp"></div></td>
				  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2">&nbsp; <font face="Verdana" color="#000000"><b> <font style="font-size: 8.5pt">Reser</font></b></font><font style="font-size: 8.5pt"><b><font face="Verdana" color="#000000">voirs</font></b></font></td>
            </tr>
            <tr>
              <td colspan="3"><table border="0" width="750" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="285" align="center" height="23" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Type</font></td>
                  <td align="center" width="228" height="23" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Total Nos.</font></td>
                  <td align="center" width="237" height="23" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> In SC / ST bastis(Nos.)</font></td>
                </tr>
                <tr>
                  <td width="285"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Clear Water Reservoir (CWR) - Underground </font> </td>
                  <td align="center" width="228"><input type="text" name="cwr_total" id="cwr_total" size="18" class="txt5" onBlur="show_cwr_cap();numeric(this)" value="<?php echo $rowFormDetails['cwr_total'];?>"></td>
                  <td align="center" width="237"><input type="text" name="cwr_sc_st" id="cwr_sc_st" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $rowFormDetails['cwr_sc_st'];?>"></td>
                </tr>
				<tr>
					<td>&nbsp;</td>
                    <td><div id="cwr_cap"></div></td>
					<td>&nbsp;</td>
				</tr>		
                <tr>
                  <td width="285"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Ground Level Service Reservoir (GLSR)</font></td>
                  <td align="center" width="228"><input type="text" name="glsr_total" id="glsr_total" size="18" class="txt5" onBlur="show_glsr_cap();numeric(this)" value="<?php echo $rowFormDetails['glsr_total'];?>"></td>
                  <td align="center" width="237"><input type="text" name="glsr_sc_st" id="glsr_sc_st" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $rowFormDetails['glsr_sc_st'];?>"></td>
                </tr>
				<tr>
					<td>&nbsp;</td>
                    <td><div id="glsr_cap"></div></td>
					<td>&nbsp;</td>
                 </tr>
                <tr>
                  <td width="285"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Ground Level Reservoir (GLR)</font></td>
                  <td align="center" width="228"><input type="text" name="glr_total" id="glr_total" size="18" class="txt5" onBlur="show_glr_cap();numeric(this)" value="<?php echo $rowFormDetails['glr_total'];?>"></td>
                  <td align="center" width="237"><input type="text" name="glr_sc_st" id="glr_sc_st" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $rowFormDetails['glr_sc_st'];?>"></td>
                </tr>
				<tr>
					<td>&nbsp;</td>
                    <td><div id="glr_cap"></div></td>
					<td>&nbsp;</td>
                 </tr>
                <tr>
                  <td width="285"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Over Head Service Reservoir (OHSR)</font></td>
                  <td align="center" width="228"><input type="text" name="ohsr_total" id="ohsr_total" size="18" class="txt5" onBlur="show_ohsr_cap();numeric(this)" value="<?php echo $rowFormDetails['ohsr_total'];?>"></td>
                  <td align="center" width="237"><input type="text" name="ohsr_sc_st" id="ohsr_sc_st" size="18" class="txt5" onBlur="numeric(this)"  value="<?php echo $rowFormDetails['ohsr_sc_st'];?>"></td>
                </tr>
				<tr>
					<td>&nbsp;</td>
                    <td><div id="ohsr_cap"></div></td>
					<td>&nbsp;</td>
                 </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3">&nbsp; <b> <font style="font-size: 8.5pt" face="Verdana" color="#000000"> Pipelines (Rising Main)</font></b></td>
            </tr>
            <tr>
              <td colspan="3"><table border="0" width="750" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center" width="216" height="22" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Material</font></td>
                    <td width="268" height="22" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Size(mm)</font></td>
                    <td width="266" height="22" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Length (Km)</font></td>
                  </tr>
				<?php
				/* for($i=1; $i<=12; $i++)
				 {
				 ?>
                 <tr>
                    <td width="216" align="center">
						<select size="1" name="ris_material<?php echo $i;?>" id="ris_material<?php echo $i;?>" class="txt" >
						<option selected value="0">Select Material</option>
						<?php 
						//$material=array(1=>'AC', 'PVC', 'HDPE', 'G.I.', 'D.I.', 'C.I.');
						foreach($material as $key=>$val)
						{
		   					echo "<option value=$val>$val</option>";
						}
						?>
						</select></td>
                    <td align="center"><select size="1" name="ris_size<?php echo $i;?>" id="ris_size<?php echo $i;?>" class="txt">
						<option selected value="0">Select Size</option>
						<?php 
						foreach($size as $key=>$val)
						{
		   					echo "<option value=$val>$val</option>";
						}
						?>
						</select></td>
					<td align="center"><input type="text" name="ris_length<?php echo $i;?>" id="ris_length<?php echo $i;?>" size="18" class="txt5" onBlur="float(this)"></td>
				  </tr>
				<?php } */?>
				<?php
				 for($i=1; $i<=12; $i++)
				 {
				 ?>
                 <tr>
                    <td width="216" align="center">
						<select size="1" name="ris_material<?php echo $i;?>" id="ris_material<?php echo $i;?>" class="txt" >
						<option selected value="0">Select Material</option>
						<?php 
						//$material=array(1=>'AC', 'PVC', 'HDPE', 'G.I.', 'D.I.', 'C.I.');
						foreach($material as $key=>$val)
						{
							
		   					?><option value=<?php echo $val; if($countArr>=$i && $arrMeterial[$i]==$val){ echo " selected"; } ?>><?php echo $val; ?></option>
							<?php
						}
						?>
						</select></td>
                    <td align="center"><select size="1" name="ris_size<?php echo $i;?>" id="ris_size<?php echo $i;?>" class="txt">
						<option selected value="0">Select Size</option>
						<?php 
						foreach($size as $key=>$val)
						{
		   					?><option value=<?php echo $val; if($countArr>=$i && $arrSize[$i]==$val){ echo " selected";}?>><?php echo $val; ?></option>
							<?php
						}
						?>
						</select></td>
					<td align="center"><input type="text" name="ris_length<?php echo $i;?>" id="ris_length<?php echo $i;?>" size="18" class="txt5" onBlur="float(this)" value="<?php echo $arrLength[$i];?>"></td>
				  </tr>
				<?php } ?>
                  <tr>
                    <td width="216">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3">&nbsp; <b> <font style="font-size: 8.5pt" face="Verdana" color="#000000"> Pipelines (Distribution Main)</font></b></td>
            </tr>
            <tr>
              <td colspan="3"><table border="0" width="750" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center" width="216" height="22" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Material</font></td>
                    <td width="268" height="22" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Size(mm)</font></td>
                    <td width="266" height="22" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#000000"> Length (Km)</font></td>
                  </tr>
				<?php
				 for($i=1; $i<=12; $i++)
				 {
				?>
                  <tr>
                    <td width="216" height="23" align="center">
						<select size="1" name="dis_material<?php echo $i;?>" id="dis_material<?php echo $i;?>" class="txt" >
							<option selected value="0">Select Material</option>
							<?php 
							foreach($material as $key=>$val)
							{
		   						/*echo "<option value=$val>$val</option>";
							}*/
							?>
							<option value=<?php echo $val; if($countArr2>=$i && $arrMeterial2[$i]==$val){ echo " selected"; } ?>><?php echo $val; ?></option>
							<?php
						}
						?>
				    </select></td>
                    <td align="center"><select size="1" name="dis_size<?php echo $i;?>" id="dis_size<?php echo $i;?>" class="txt">
						<option selected value="0">Select Size</option>
						<?php 
						foreach($size as $key=>$val)
						{
		   					?><option value=<?php echo $val; if($countArr2>=$i && $arrSize2[$i]==$val){ echo " selected";}?>><?php echo $val; ?></option>
							<?php
						}
						?>
						</select></td>
                    <td align="center"><input type="text" name="dis_length<?php echo $i;?>" id="dis_length<?php echo $i;?>" size="18" class="txt5" onBlur="float(this)" value="<?php echo $arrLength2[$i];?>"></td>
                  </tr>
				  <?php } ?>
                  <tr>
                    <td width="216">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td bgcolor="#EEEEEE" height="20" colspan="4"><span style="font-weight: 700"><font face="Arial" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;Public Stand Post (PSP) </font></span> </td>
            </tr>
            <tr>
              <td colspan="2"><table border="0" width="750" id="table12" cellpadding="0">
                  <tr>
                    <td align="center" bgcolor="#F7E6B7" colspan="2" width="100%"><font style="font-size: 8.5pt" face="Verdana" color="#990000"> No. of PsPs</font></td>
                  </tr>
                  <tr>
                    <td width="50%" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000"> Total</font></td>
                    <td width="50%" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000"> In SC / ST Bastis</font></td>
                  </tr>
                  <tr>
                    <td width="50%" align="center"><input type="text" name="psp_total" id="psp_total" size="20" class="txt5" value="<?php echo $rowFormDetails['psp_total'];?>" onBlur="showpsp_q1();numeric(this)"></td>
                    <td width="50%" align="center"><input type="text" name="psp_sc_st" id="psp_sc_st" size="20" class="txt5" value="<?php echo $rowFormDetails['psp_sc_st'];?>" onBlur="numeric(this)"></td>
                  </tr>
                  <tr>
                    <td colspan="2">&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="2"><div id="show_psp_q1"></div></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3">&nbsp;</td>
            </tr>
          </table></td>
		</tr>
		<tr>
			<td>
			<span style="font-size: 5pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>
			<p align="center">
			<input type="submit" value="Update" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid black; border-width: 2px">&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		</table>
</form>		
</div>

</body>
</html>